<%@ page import="java.sql.*, studentportal.*"%>
<html>

<head>
 
<title>Branch Details Information</title>
<script language="JavaScript">
	var xmlRequest;

function callBackSemister() {
  if(xmlRequest.readyState==4) {
    if(xmlRequest.status==200) {
var xmlObject=xmlRequest.responseXML.getElementsByTagName("ID");
var temp=new Option("----Select----","0");
document.myform.semister.options[0]=temp;
for(var i=0;i<xmlObject.length;i++) {
var id=xmlRequest.responseXML.getElementsByTagName("ID")[i].childNodes[0].nodeValue;
var text=xmlRequest.responseXML.getElementsByTagName("TEXT")[i].childNodes[0].nodeValue;
temp=new Option(text,id);
document.myform.semister.options[i+1]=temp;
	}
  }
  }
}

	function getSemisterList() {
		var temp=new Option("----Select----","0");
		var temp1=new Option("----Select----","0");
		for(var i=document.myform.semister.length;i>0;i--)
			document.myform.semister.options[0]=null;
		for(var i=document.myform.subject.length;i>0;i--)
			document.myform.subject.options[0]=null;
		document.myform.semister.options[0]=temp;
		//document.myform.question_list.options[0]=temp1;
		document.myform.subject.value = ""

		if (window.XMLHttpRequest) {
			xmlRequest = new XMLHttpRequest();
			
		} else if (window.ActiveXObject) {
			xmlRequest =new ActiveXObject("Microsoft.XMLHTTP");
			
		}
		xmlRequest.open("POST","SemisterList.jsp",true);
	xmlRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlRequest.send("ID="+document.myform.course.value);
		xmlRequest.onreadystatechange=callBackSemister;

	} 
function callBackSubject() {
  if(xmlRequest.readyState==4) {
    if(xmlRequest.status==200) {
var xmlObject=xmlRequest.responseXML.getElementsByTagName("ID");
var temp=new Option("----Select----","0");
document.myform.subject.options[0]=temp;
for(var i=0;i<xmlObject.length;i++) {
var id=xmlRequest.responseXML.getElementsByTagName("ID")[i].childNodes[0].nodeValue;
var text=xmlRequest.responseXML.getElementsByTagName("TEXT")[i].childNodes[0].nodeValue;
temp=new Option(text,id);
document.myform.subject.options[i+1]=temp;
	}
  }
  }
}

	function getSubjectList() {
		var temp=new Option("----Select----","0");
		var temp1=new Option("----Select----","0");
		for(var i=document.myform.subject.length;i>0;i--)
			document.myform.subject.options[0]=null;
		document.myform.subject.options[0]=temp;
		if (window.XMLHttpRequest) {
			xmlRequest = new XMLHttpRequest();
			
		} else if (window.ActiveXObject) {
			xmlRequest =new ActiveXObject("Microsoft.XMLHTTP");
			
		}
		xmlRequest.open("POST","SubjectList.jsp",true);
	xmlRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlRequest.send("ID="+document.myform.semister.value+"&CID="+document.myform.course.value);
		xmlRequest.onreadystatechange=callBackSubject;

	} 

</script>
</head>
<body background="indtextb.jpg" bgcolor="#FFFFFF" text="#000000" link="#3366CC" vlink="#666666" alink="#996600">

<!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><!--mstheme--></font>

<table border="0" width="100%">
  <tr>
    <td width="100%"><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><img border="0" src="StdPrtlbanner.jpg" width="846" height="65">&nbsp;<!--mstheme--></font></td>
  </tr>
</table>
<!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><!--mstheme--></font>
<table border="0" width="100%">
  <tr>
    <td width="23%">
      <!--mstheme--><font face="Trebuchet MS, Arial, Helvetica">
      <p align="center"><a href="AdminAdmissionHome.html">Admissions</a><!--mstheme--></font></td>
    <td width="23%">
      <!--mstheme--><font face="Trebuchet MS, Arial, Helvetica">
      <p align="center"><a href="AdminStudentHome.html">Students</a><!--mstheme--></font></td>
    <td width="23%">
      <!--mstheme--><font face="Trebuchet MS, Arial, Helvetica">
      <p align="center"><a href="AdminFacultyHome.html">Faculties</a><!--mstheme--></font></td>

    <td width="20%">
      <!--mstheme--><font face="Trebuchet MS, Arial, Helvetica">
      <p align="center"><a href="AdminNotificaiton.jsp">Notifications</a><!--mstheme--></font></td>

    <td width="20%">
      <!--mstheme--><font face="Trebuchet MS, Arial, Helvetica">
      <p align="center"><a href="AdvertisementView.jsp">Examination</a><!--mstheme--></font></td>

    <td width="20%">
      <!--mstheme--><font face="Trebuchet MS, Arial, Helvetica">
      <p align="center"><a href="AdminBranchHome.html">Branches</a><!--mstheme--></font></td>

    <td width="20%">
      <!--mstheme--><font face="Trebuchet MS, Arial, Helvetica">
      <p align="center"><a href="AdminBooksHome.html">Books</a><!--mstheme--></font></td>
    <td width="20%">
      <!--mstheme--><font face="Trebuchet MS, Arial, Helvetica">
      <p align="center"><a href="AdminCourseHome.html">Courses</a><!--mstheme--></font></td>

    <td width="20%">
      <!--mstheme--><font face="Trebuchet MS, Arial, Helvetica">
      <p align="center"><a href="AdminSemesterHome.html">Semesters</a><!--mstheme--></font></td>

    <td width="20%">
      <!--mstheme--><font face="Trebuchet MS, Arial, Helvetica">
      <p align="center"><a href="AdminSubjectHome.html">Subjects</a><!--mstheme--></font></td>

    <td width="20%">
      <!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"><a href="AdminDesignationHome.html">Designation</a><!--mstheme--></font></td>

	  <td width="20%">
      <!--mstheme--><font face="Trebuchet MS, Arial, Helvetica">
      <p align="center"><a href="Home.html">Home</a><!--mstheme--></font></td>
  </tr>
</table>
<form method="POST" name="myform" action="AdminFacultyServletMasterEntry.jsp">
<div align="center">
  <center>
				<%
					Connection con=MySQLDriver.getConnection(); 
					ResultSet rs=null;
					System.out.println("After Statement");
					Statement st=null;							
					st=con.createStatement();
					rs=st.executeQuery("select faculty_id, faculty_name, faculty_join_date, (select branch_name from branch_master where faculty_master.faculty_dept_id=branch_master.branch_id), (select desigantion_name from designation_master where faculty_master.faculty_designation_id=designation_master.designation_id),faculty_dept_id from faculty_master where faculty_id="+request.getParameter("FID"));
					if(rs!=null && rs.next())
					{
					String fcid=rs.getString(1);

				%>
    <input type="hidden" name="fid" value="<%=rs.getString(1)%>"/>
    <input type="hidden" name="bid" value="<%=rs.getString(6)%>"/>
  
  <table border="1" width="65%" bgcolor="#FFFFFF" height="236">
    <tr>
      <td width="100%" valign="middle" align="right" bgcolor="#FFFFFF" background="file:///C:/Documents%20and%20Settings/Administrator/My%20Documents/My%20Pictures/strbkgde.gif" height="23" colspan="2">
        <p align="center"><font size="4" color="#0000FF"><b>Assign Faculty Entry Information</b></font>
    </tr>
    <tr>
      <td width="50%" valign="middle" align="left" background="file:///C:/Documents%20and%20Settings/Administrator/My%20Documents/My%20Pictures/strbkgde.gif" height="23" bgcolor="#FFFFFF">Faculty ID</td>
      <td width="50%" background="file:///C:/Documents%20and%20Settings/Administrator/My%20Documents/My%20Pictures/strbkgde.gif" height="23"><input type="text" name="NAME" value='<%=rs.getString(1)%>' size="40"></td>
    </tr>
    <tr>
      <td width="50%" valign="middle" align="left" background="file:///C:/Documents%20and%20Settings/Administrator/My%20Documents/My%20Pictures/strbkgde.gif" height="23" bgcolor="#FFFFFF">Name</td>
      <td width="50%" background="file:///C:/Documents%20and%20Settings/Administrator/My%20Documents/My%20Pictures/strbkgde.gif" height="23"><input type="text" name="NAME" value='<%=rs.getString(2)%>' size="40"></td>
    </tr>
    <tr>
      <td width="50%" valign="middle" align="left" background="file:///C:/Documents%20and%20Settings/Administrator/My%20Documents/My%20Pictures/strbkgde.gif" height="23" bgcolor="#FFFFFF">Department</td>
      <td width="50%" background="file:///C:/Documents%20and%20Settings/Administrator/My%20Documents/My%20Pictures/strbkgde.gif" height="23"><input type="text" value='<%=rs.getString(4)%>' name="NAME" size="40"></td>
    </tr>
    <tr>
      <td width="50%" valign="middle" align="left" background="file:///C:/Documents%20and%20Settings/Administrator/My%20Documents/My%20Pictures/strbkgde.gif" height="23" bgcolor="#FFFFFF">Designation</td>
      <td width="50%" background="file:///C:/Documents%20and%20Settings/Administrator/My%20Documents/My%20Pictures/strbkgde.gif" height="23"><input type="text" value='<%=rs.getString(5)%>' name="NAME" size="40"></td>
    </tr>
    <tr>
      <td width="50%" valign="middle" align="left" background="file:///C:/Documents%20and%20Settings/Administrator/My%20Documents/My%20Pictures/strbkgde.gif" height="23" bgcolor="#FFFFFF">Course</td>
      <td><select size="1" name="course" tabindex="7" onChange="getSemisterList()">
      <option value='0'>-------Select--------</option>
<%
					Statement st1=con.createStatement();
					ResultSet rs1=null;
					 st1=con.createStatement();
					System.out.println("After Statement");
					 rs1=st1.executeQuery("select * from course_master where branch_id="+rs.getString(6)+" order by course_id");
					while(rs1.next())
					{
		%>
						<option value='<%=rs1.getString(1)%>'><%=rs1.getString(2)%>&nbsp;-[&nbsp;<%=rs1.getString(7)%>]</option>
		<%
					}
					rs1.close();
					st1.close();
		%>
       </select></td>
    </tr>
    <tr>
      <td width="50%" valign="middle" align="left" background="file:///C:/Documents%20and%20Settings/Administrator/My%20Documents/My%20Pictures/strbkgde.gif" height="23" bgcolor="#FFFFFF">Semister</td>
      <td><select size="1" name="semister" tabindex="7" onchange="getSubjectList()">
      <option value='0'>-------Select--------</option>
       </select></td>
    </tr>
    <tr>
      <td width="50%" valign="middle" align="left" background="file:///C:/Documents%20and%20Settings/Administrator/My%20Documents/My%20Pictures/strbkgde.gif" height="23" bgcolor="#FFFFFF">Subject</td>
      <td><select size="1" name="subject" tabindex="7" >
      <option value='0'>-------Select--------</option>
       </select></td>
    </tr>
    <tr>
      <td width="100%" colspan="2" background="file:///C:/Documents%20and%20Settings/Administrator/My%20Documents/My%20Pictures/strbkgde.gif" height="24">
        <p align="center"><input type="submit" value="Assign" name="action"></td>
    </tr>
  </table>
  </center>
  				<%
					
					}
					rs.close();
					st.close();
					con.close();
  %>
</div>
</form>

</body>

</html>
